package com.study.Caro;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;

public class mainmenu extends Activity{
	
	/*=====================attribute========================*/
	ImageButton multi_play;
	ImageButton exit;
	/*======================================================*/
	
	/*=======================method=========================*/
	public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mainmenu);
        
        multi_play = (ImageButton) findViewById(R.id.multi_play);
        exit = (ImageButton) findViewById(R.id.exit);
        
        multi_play.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent i = new Intent(mainmenu.this,Menu.class);
				startActivity(i);
			}
		});
        
        
        exit.setOnClickListener(new OnClickListener() {
		 
			public void onClick(View arg0) {
				AlertDialog.Builder builder = new AlertDialog.Builder(mainmenu.this);
				
				builder.setMessage("	  Do you really want to exit ?")
				       .setCancelable(false)
				       .setNegativeButton("No", new DialogInterface.OnClickListener() {
				           public void onClick(DialogInterface dialog, int id) {
				                dialog.cancel();
				           }
				       })
				       .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
				           public void onClick(DialogInterface dialog, int id) {
				                finish();
				                System.exit(0);
				                android.os.Process.killProcess(android.os.Process.myPid());
				           }
				       });
				 builder.show();				
			}
		});
        
	}
	/*======================================================*/
}
